2023-07-10

Using .desktop Files for Bookmarks

Trying to use bookmarks in browsers to go to commonly visited sites is unfortunately a somewhat terrible experience. So long ago I switched to just doing that externally: Until now I just used a script that opened all these bookmarks in a menu (fuzzel, but any dmenu-like menu works for stuff like this). But as a fan of "do what I mean" features, it always annoyed me how this was yet another separate menu; Press Super+d for applications and Super+o for bookmarks. A bit primitive.

Having custom actions appear in application menus on linux is actually trivial. Just write a custom .desktop file and put it into ~/.local/share/applications/. Each bookmark in its own desktop file would be a bit excessive, but luckily the spec allows to have more than one action per .desktop file.

Here is an example:

[Desktop Entry]
Encoding=UTF-8
Name=bookmark
Comment=online bookmarks
Exec=firefox
Terminal=false
Type=Application
Icon=firefox
Actions=my-site;sourcehut;

[Desktop Action my-site]
Name=My Website
Exec=firefox https://leon_plickat.srht.site

[Desktop Action sourcehut]
Name=sourcehut
Exec=firefox "https://git.sr.ht/"

Now I can open sourcehut inside firefox comfortably from my application menu. No longer do I first have to waste a thought on whether the thing I want to open is an application or a website (and honestly some things are simply both). Nice.

This obviously also works with local files. There are a few books I use often, so I created entries for them as well, this time using xdg-open as the opener.

Having to edit .desktop files to add bookmarks is not very convenient. However the ability to open commonly used webpages and files from my application launcher is worth it for me. I know the launchers of the big desktops do something similar out of the box, but mine doesn't and this is a fine workaround in the meantime. Also I was never particularly happy with how both gnomes launcher and krunner find important files anyway, so at least for me the actual UX of my .desktop file is a tiny bit better, since it gives me direct control over what does appear in the menu and what doesn't.

I do eventually want to have an application launcher menu that allows me to insert non-application entries programmatically, but for now this is enough.

Articles from blogs I read (generated by openring)

in which our protagonist dreams of laurels

I had a dream the other evening, in which I was at a large event full of hackers—funny, that this is the extent of my dreams at the moment; as a parent of three young kids, I don’t get out much—and, there, I was to receive an award and give a speech. (I kno…

wingolog, December 17, 2025

vm.overcommit_memory=2 is always the right setting for servers

The Linux kernel has a feature where you can tune the behavior of memory allocations: the vm.overcommit_memory sysctl. When overcommit is enabled (sadly, this is the default), the kernel will typically return a mapping when brk(2) or mmap(2) is called to…

Ariadne's Space, December 16, 2025

Status update, November 2025

Hi! This month a lot of new features have added to the Goguma mobile IRC client. Hubert Hirtz has implemented drafts so that unsent text gets saved and network disconnections don’t disrupt users typing a message. He also enabled replying to one’s own messages…

emersion, November 16, 2025